package com.minimalist.common.entity.basic.po;


import com.minimalist.common.config.mybatis.InsertFullColumnHandler;
import com.minimalist.common.config.mybatis.UpdateFullColumnHandler;
import com.minimalist.common.config.mybatis.bo.BaseEntity;
import com.mybatisflex.annotation.Table;

import java.io.Serial;
import java.io.Serializable;
import java.util.Objects;

/**
 * 参数配置表 实体类。
 *
 * @author 小太阳
 * @since 2024-10-18
 */

@Table(value = "m_config", onInsert = InsertFullColumnHandler.class, onUpdate = UpdateFullColumnHandler.class)
public class MConfig extends BaseEntity implements Serializable{

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 参数ID
     */
    private Long configId;

    /**
     * 参数名称
     */
    private String configName;

    /**
     * 参数键名
     */
    private String configKey;

    /**
     * 参数键值
     */
    private String configValue;

    /**
     * 说明
     */
    private String description;

    /**
     * 状态  0禁用 1正常
     */
    private Integer status;

    public MConfig(){
    }

    public MConfig(Long configId, String configName, String configKey, String configValue, String description, Integer status){
        this.configId = configId;
        this.configName = configName;
        this.configKey = configKey;
        this.configValue = configValue;
        this.description = description;
        this.status = status;
    }

    public Long getConfigId(){
        return configId;
    }

    public void setConfigId(Long configId){
        this.configId = configId;
    }

    public String getConfigName(){
        return configName;
    }

    public void setConfigName(String configName){
        this.configName = configName;
    }

    public String getConfigKey(){
        return configKey;
    }

    public void setConfigKey(String configKey){
        this.configKey = configKey;
    }

    public String getConfigValue(){
        return configValue;
    }

    public void setConfigValue(String configValue){
        this.configValue = configValue;
    }

    public String getDescription(){
        return description;
    }

    public void setDescription(String description){
        this.description = description;
    }

    public Integer getStatus(){
        return status;
    }

    public void setStatus(Integer status){
        this.status = status;
    }

    @Override
    public boolean equals(Object o){
        if (this == o){
            return true;
        }
        if (o == null || getClass() != o.getClass()){
            return false;
        }
        MConfig mConfig = (MConfig) o;
        return Objects.equals(configId, mConfig.configId) &&
                Objects.equals(configName, mConfig.configName) &&
                Objects.equals(configKey, mConfig.configKey) &&
                Objects.equals(configValue, mConfig.configValue) &&
                Objects.equals(description, mConfig.description) &&
                Objects.equals(status, mConfig.status);
    }

    @Override
    public int hashCode(){
        return Objects.hash(configId, configName, configKey, configValue, description, status);
    }

    @Override
    public String toString(){
        return "MConfig{" +
                "configId=" + configId +
                ", configName='" + configName + '\'' +
                ", configKey='" + configKey + '\'' +
                ", configValue='" + configValue + '\'' +
                ", description='" + description + '\'' +
                ", status=" + status +
                '}';
    }

    public static MConfigBuilder builder(){
        return new MConfigBuilder();
    }

    public static class MConfigBuilder{
        private Long configId;
        private String configName;
        private String configKey;
        private String configValue;
        private String description;
        private Integer status;

        MConfigBuilder(){
        }

        public MConfigBuilder configId(Long configId){
            this.configId = configId;
            return this;
        }

        public MConfigBuilder configName(String configName){
            this.configName = configName;
            return this;
        }

        public MConfigBuilder configKey(String configKey){
            this.configKey = configKey;
            return this;
        }

        public MConfigBuilder configValue(String configValue){
            this.configValue = configValue;
            return this;
        }

        public MConfigBuilder description(String description){
            this.description = description;
            return this;
        }

        public MConfigBuilder status(Integer status){
            this.status = status;
            return this;
        }

        public MConfig build(){
            return new MConfig(configId, configName, configKey, configValue, description, status);
        }

        public String toString(){
            return "MConfig.MConfigBuilder(" +
                    "configId=" + this.configId +
                    ", configName=" + this.configName +
                    ", configKey=" + this.configKey +
                    ", configValue=" + this.configValue +
                    ", description=" + this.description +
                    ", status=" + this.status +
                    ")";
        }
    }
}
